#!/bin/sh

. ../eval_tools.sh

HEADER "if snmpnetstat finds the running agent in udpTable"

if test `uname -s` = "HP-UX" ; then
    if test `id -u` != "0" ; then
        # The agent needs to be run as root - else force skip
        SKIP
    fi
fi

SKIPIF DISABLE_SNMPV2C
SKIPIFNOT USING_MIBII_UDPTABLE_MODULE

# snmpnetstat only works with UDP
[ "x$SNMP_TRANSPORT_SPEC" = "x" -o "x$SNMP_TRANSPORT_SPEC" = "xudp" ] || SKIP

# make sure snmpnetstat can be executed
SNMPNETSTAT="${SNMP_UPDIR}/apps/snmpnetstat/snmpnetstat"
[ -x "$SNMPNETSTAT" ] || SKIP

snmp_version=v2c
. ./Sv2cconfig

#
# Begin test
#

STARTAGENT

CAPTURE "$SNMPNETSTAT -Cn -Cp udp -$snmp_version -c testcommunity $SNMP_TEST_DEST$SNMP_SNMPD_PORT"
CHECKORDIE "$SNMP_SNMPD_PORT"

STOPAGENT
FINISHED
